<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$title}</title>
    <style>
        body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #f7f7f7; margin: 0; padding: 0; }
        .container { max-width: 400px; margin: 60px auto; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 32px 24px; text-align: center; width: 80%;}
        .avatar { width: 80px; height: 80px; border-radius: 50%; margin-bottom: 16px; border: 2px solid #eee; }
        .nickname { font-size: 1.3em; font-weight: bold; margin-bottom: 8px; color: #333; }
        .openid { font-size: 0.95em; color: #888; margin-bottom: 16px; word-break: break-all; }
        .desc { color: #666; margin-bottom: 16px; }
    </style>
</head>
<body>
    <div class="container">
        <h1>欢迎来到首页！</h1>
        {notempty name="user"}
            <img class="avatar" src="{$user.avatar|default='https://via.placeholder.com/80'}" alt="头像">
            <div class="nickname">{$user.nickname|default='未获取昵称'}</div>
            <div class="openid">OpenID: {$user.openid|default='-'}</div>
            <div class="desc">欢迎您，感谢使用本系统！</div>
        {else/}
            <div class="desc">未获取到用户信息，请重新登录。</div>
        {/notempty}
    </div>
    <script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js" type="text/javascript" charset="utf-8"></script>
    <script type="text/javascript" charset="utf-8">
        let wxConfig = "{$wxConfig|json_encode}"
        // 去除&quote;
        wxConfig = JSON.parse(wxConfig.replace(/&quot;/g, '"'))
        wx.config(wxConfig);
        wx.ready(function () {
            // 分享参数
            var shareData = {
                title: '{$title|default="首页"}', // 分享标题
                desc: '欢迎访问本系统，体验微信分享功能', // 分享描述
                link: window.location.href, // 分享链接
                imgUrl: '{$user.avatar|default="https://via.placeholder.com/80"}', // 分享图标
                success: function () {
                    // 用户确认分享后执行的回调函数
                },
                cancel: function () {
                    // 用户取消分享后执行的回调函数
                }
            };
            // 分享给朋友
            wx.updateAppMessageShareData(shareData);
            // 分享到朋友圈
            wx.updateTimelineShareData(shareData);
        });
    </script>
</body>
</html>